package com.minidemotouch;

import mobilefeel.sdk.MobileFeelActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends MobileFeelActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        this.findViewById(R.id.conectar).setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View arg0) {
				EditText entry = (EditText) findViewById(R.id.entry);
				String ip = (entry.getText().toString()).split(":")[0];
				String puerto = (entry.getText().toString()).split(":")[1];
				connect(ip, Integer.parseInt(puerto));
				Toast.makeText(MainActivity.this,"Conectando... "+entry.getText().toString(),Toast.LENGTH_SHORT).show();
			}});


    }

	@Override
	protected void onConnectionEstablished() {
		super.onConnectionEstablished();
		Toast.makeText(this, "Conectado", Toast.LENGTH_SHORT).show();
		Intent i = new Intent(this, MiniDemoActivity.class);
		startActivity(i);
	}
	
	@Override
	protected void onConnectionFailed(String reason) {
		Toast.makeText(this, reason, Toast.LENGTH_SHORT).show();
		super.onConnectionFailed(reason);
	}


}